//Computes the dot product of two vectors (return = v1 . v2)
float Vector_Dot_Product(float v1[3], float v2[3])
{
  float res = 0;

  for(int i=0; i<3; i++)
  {
    res += v1[i] * v2[i];
  }

  return res; 
}

//Computes the cross product of two vectors (vout = v1 ^ v2)
void Vector_Cross_Product(float vout[3], float v1[3], float v2[3])
{
  vout[0] = (v1[1]*v2[2]) - (v1[2]*v2[1]);
  vout[1] = (v1[2]*v2[0]) - (v1[0]*v2[2]);
  vout[2] = (v1[0]*v2[1]) - (v1[1]*v2[0]);
}

//Multiply a vector by a scalar (vout = scale * v)
void Vector_Scale(float vout[3], float v[3], float scale)
{
  for(int i=0; i<3; i++)
  {
    vout[i] = v[i] * scale; 
  }
}

//Add two vectors (vout =  v1 + v2)
void Vector_Add(float vout[3], float v1[3], float v2[3])
{
  for(int i=0; i<3; i++)
  {
    vout[i] = v1[i] + v2[i];
  }
}

//Add and scale two vectors (vout = vout + scale * v)
void Vector_Add_Scale(float vout[3], float v[3], float scale)
{
  for(int i=0; i<3; i++)
  {
    vout[i] += scale * v[i];
  }
}

//Return the norm 2 of a vector (return = |v])
float Vector_Norm(float v[3])
{
  float norm = 0;

  for(int i=0; i<3; i++)
  {
    norm += v[i] * v[i];
  }

  return sqrt(norm);
}

